
<template>
  <div class="parent">
    <Table :columns="feedbackColumns" :list="responseList" :tableId="'text'" fit="cover" :update-func="updateFunc">
      <template #pagination>
        <el-pagination layout="prev, pager, next, jumper" :total="responseTotal" :page-size="responseSize"
          @current-change="handleCurrentChange" />
      </template>
    </Table>
  </div>
</template>
<script lang="ts" setup>
import Table from '@/components/table/Table.vue'
import { GetFeedback } from '@/vendors/feedback/feedback';
import useSetting from '@/vendors/store/setting'
import { watch } from 'vue'
const {
  list,
  responsePage,
  responseTotal,
  feedbackColumns,
  responseList,
  responseSize
} = GetFeedback()
list()
const setting = useSetting()
const handleCurrentChange = (value: number) => {
  responsePage.value = value
  list()
}
const updateFunc = () => {
  responsePage.value -= 1
  setting.setUserAlbumVideoCount(setting.count[4].num - 1)
  list()
}
watch(() => setting.refreshCount, () => {
  if (setting.refreshCount) {
    // 需要刷新当前页
    const len = responseList.value.length
    const flag = len !=0 && len % responseSize.value == 0  // 列表是整10倍数
    if (!flag) {
      // 非整10倍数
      responsePage.value -= 1
      list()
    }
    setting.setRefreshCount(!setting.refreshCount)
  }
})
</script>
<style scoped lang="scss">
.parent {
  background: white;
  padding: 32px 48px;
  border-radius: 16px;
  box-shadow: -3px 0 4px 1px #0000001A, 3px 0 4px 1px #0000001A;
}
</style>